'use strict'
let koa = require('koa');

let app = new koa();

let {Sequelize,DataTypes} = require('sequelize');

let seq = new Sequelize('soft2','postgres','qq_112358',{
    host:'172.16.10.214',
    dialect:'postgres'
});

let x = seq.define('products',{
    productName:{
        type:DataTypes.STRING(80),
        allowNull:false
    },
    print:{
        type:DataTypes.DECIMAL(20,2),
        allowNull:false,
        defaultValue:0
    }
});

(async()=>{
    await seq.sync({force:true}).then(()=>{
        x.create({
            productName:"mian",
            print:"1234"
        })
    });
})();

// (async()=>{
//     Sequelize.sync({force:true}).then(()=>{
//         User.create({
//             name:"mian",
//             age:"1234"
//         })
//     })
// })();

app.listen(5006);

console.log("http://localhost：5006");
